/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pcs.Lista03.Exercicio03;

/**
 *
 * @author Daniel
 */
public class Data {
    int day;
    int month;
    int year;

    public Data(int dia, int mes, int ano) {
        this.day = dia;
        this.month = mes;
        this.year = ano;
        
        if (dia < 01 || dia > 31)
            this.day = 1;
        if (mes < 01 || mes > 12)
            this.month = 1;
        if (ano < 01 || ano > 2013)
            this.year = 1980;
        
    }
        
        public int getAno() {
        return year;
    }

    public void setAno(int ano) {
        this.year = ano;
    }

    public int getDia() {
        return day;
    }

    public void setDia(int dia) {
        this.day = dia;
    }

    public int getMes() {
        return month;
    }

    public void setMes(int mes) {
        this.month = mes;
    }
    
    public int diaDaSemana() {
        if (month < 3) {
            month = month + 12;
            year = year - 1;
        }

        
int diaDaSemana = (
day + (2 * month) + (int) (6 * (month + 1) / 10) + year
+ (int) (year / 4) - (int) (year / 100)
+ (int) (year / 400) + 1 ) % 7;
    
    
    return diaDaSemana;
    }
    
   
}
